library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.4     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   2.0.1     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggplot2)
library(gplots)
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
library(dplyr)
library(readr)
library(gganimate)
library(gifski)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3PA` <- ggplot(X3_pointers, aes(x=`Season`, y=`3PA`))+
  geom_line(aes(group=5, col="red"))+
  theme(legend.position = "None")+
  ggtitle("3PA per Game by Season")+
  xlab("Season")+ylab("Average 3PA per Game")+
  transition_reveal(Season)
`3PA`
animate(`3PA`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())

anim_save("3PAAnimated2.gif")
  1. In this visualization, it is clear that there has been a major increase in 3-pointers attempted per game over the last 10 seasons. Back in the 2011-12 season, the league average was around just 18 attempts per game, and in last years season the average got to 34.6, an increase of 92% showing that year by year there seems to be an increase in the amount of 3-pointers attempted since it is now deemed as a more valuable and efficient shot than it was in the past.
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3PM` <- ggplot(X3_pointers, aes(x=`Season`, y=`3PM`))+
  geom_line(aes(group=5, color="red"))+
  theme(legend.position = "None")+
  ggtitle("3PM per Game by Season")+
  xlab("Season")+ylab("Average 3PM per Game")+
  transition_reveal(Season)
`3PM`
animate(`3PM`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())

anim_save("3PMAnimated.gif")
  1. Another factor we can look at is how the average makes per game adjusted as the average attempts per game increased. Obviously, there is an increase in this as well, where in the 2011-2012 season the average makes per game was 7.2, and now it has increased to 12.7, an increase of 76%, just slightly greater than the attempts per game increase. So clearly, as teams have begun to shoot more threes, teams have also began making more 3’s as the shot is becoming more valuable.
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3P%` <- ggplot(X3_pointers, aes(x=`Season`, y=`3P%`))+
   geom_line(aes(group=5, color="red"))+
  theme(legend.position = "None")+
  ggtitle("3P% by Season")+
  xlab("Season")+ylab("Average 3P%")+
  transition_reveal(Season)
`3P%`
animate(`3P%`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())

anim_save("3PM%nimated.gif")
  1. Lastly, we can see how both the increase in attempts and makes per game affects the overall 3-points percentage. As you can see, the data fluctuates year by year, but in this short 10-year visualization, it seems like there is is an increase, although it seems to always change each year. Though I’m sure if you were to look at the entire league history of 3-point percentage, that there would be an increase as players are becoming more skilled and are valuing the 3-point shot more and more.
X3toW <- read_excel("Downloads/Data Science Final.xlsx")
pf <- ggplot(X3toW, aes(x=`3P%`, y=`Win %`, col= Team ))+
  geom_point(show.legend = FALSE, alpha=0.75)
ggplotly(pf)

Here, we can look at the overall correlation between 3P% and teams Win % over the past 10 NBA seasons. Although the correlation isn’t too strong, it is obvious that there is a relationship between shooting a higher 3P%, and ultimately the number of games you win. This shows that teams that to shoot the best from behind the arc, the more likely they are to win more games.